package com.anti.modular.bus.buscostbillhydropower.controller;

import com.anti.commom.annotation.BusinessLog;
import com.anti.commom.annotation.Permission;
import com.anti.commom.enums.LogAnnotionOpTypeEnum;
import com.anti.commom.api.Result;
import com.anti.jdbc.support.page.PageParam;
import com.anti.modular.bus.buscostbillhydropower.param.BusCostBillHydropowerParam;
import com.anti.modular.bus.buscostbillhydropower.service.BusCostBillHydropowerService;
import com.anti.jdbc.support.page.PageParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 基础费用账单水电物业表控制器
 *
 * @author anti
 * @date 2021-04-08 10:23:36
 */
@RestController
@RequestMapping("busCostBillHydropower")
public class BusCostBillHydropowerController {

    @Resource
    private BusCostBillHydropowerService busCostBillHydropowerService;

    /**
     * 查询基础费用账单水电物业表
     *
     * @author anti
     * @date 2021-04-08 10:23:36
     */
    @GetMapping("page")
    public Result page(PageParam pageParam, BusCostBillHydropowerParam busCostBillHydropowerParam) {
        return Result.data(busCostBillHydropowerService.page(pageParam,busCostBillHydropowerParam));
    }

    /**
     * 添加基础费用账单水电物业表
     *
     * @author anti
     * @date 2021-04-08 10:23:36
     */
    @Permission
    @PostMapping("add")
    @BusinessLog(title = "基础费用账单水电物业表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public Result add(@RequestBody @Validated(BusCostBillHydropowerParam.add.class) BusCostBillHydropowerParam busCostBillHydropowerParam) {
            busCostBillHydropowerService.add(busCostBillHydropowerParam);
        return Result.success("新增成功");
    }

    /**
     * 删除基础费用账单水电物业表
     *
     * @author anti
     * @date 2021-04-08 10:23:36
     */
    @Permission
    @PostMapping("delete")
    @BusinessLog(title = "基础费用账单水电物业表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public Result delete(@RequestBody @Validated(BusCostBillHydropowerParam.delete.class) BusCostBillHydropowerParam busCostBillHydropowerParam) {
            busCostBillHydropowerService.delete(busCostBillHydropowerParam);
        return Result.success("删除成功");
    }

    /**
     * 编辑基础费用账单水电物业表
     *
     * @author anti
     * @date 2021-04-08 10:23:36
     */
    @Permission
    @PostMapping("edit")
    @BusinessLog(title = "基础费用账单水电物业表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public Result edit(@RequestBody @Validated(BusCostBillHydropowerParam.edit.class) BusCostBillHydropowerParam busCostBillHydropowerParam) {
            busCostBillHydropowerService.edit(busCostBillHydropowerParam);
        return Result.success("修改成功");
    }

    /**
     * 查看基础费用账单水电物业表
     *
     * @author anti
     * @date 2021-04-08 10:23:36
     */
    @GetMapping("detail")
    public Result detail(@Validated(BusCostBillHydropowerParam.detail.class) BusCostBillHydropowerParam busCostBillHydropowerParam) {
        return Result.data(busCostBillHydropowerService.detail(busCostBillHydropowerParam));
    }

    /**
     * 基础费用账单水电物业表列表
     *
     * @author anti
     * @date 2021-04-08 10:23:36
     */
    @GetMapping("list")
    public Result list(BusCostBillHydropowerParam busCostBillHydropowerParam) {
        return Result.data(busCostBillHydropowerService.list(busCostBillHydropowerParam));
    }

}
